﻿namespace Compass.Wasm.Shared.Plans;
//生产打包时，将托盘装入多个PackingItem（生成Pallet，并将Pallet的Id写入到PackingItem中）
//仓储和发货时只针对Pallet而不要关心烟罩或PackingItem

/// <summary>
/// 托盘信息
/// </summary>
public class PalletDto : BaseDto
{
    #region 基本信息
    //todo:这些信息应该写在装箱信息（托盘信息）中
    private Guid? mainPlanId;
    public Guid? MainPlanId
    {
        get => mainPlanId;
        set { mainPlanId = value; OnPropertyChanged(); }
    } //关联装箱清单

    //托盘号，按照托盘号排序
    private int? palletNumber;
    public int? PalletNumber
    {
        get => palletNumber;
        set { palletNumber = value; OnPropertyChanged(); }
    } 
    #endregion

    #region 产品独立托盘信息
    private string? mtlNumber;
    public string? MtlNumber
    {
        get => mtlNumber;
        set { mtlNumber = value; OnPropertyChanged(); }
    }
    private string? type;
    public string? Type
    {
        get => type;
        set { type=value; OnPropertyChanged(); }
    } //类型/产品型号
    private string? length;
    public string? Length
    {
        get => length;
        set { length=value; OnPropertyChanged(); }
    } //长

    private string? width;
    public string? Width
    {
        get => width;
        set { width=value; OnPropertyChanged(); }
    } //宽

    private string? height;
    public string? Height
    {
        get => height;
        set { height=value; OnPropertyChanged(); }
    } //高 

    private bool showItem;
    public bool ShowItem
    {
        get => showItem;
        set { showItem=value; OnPropertyChanged(); }
    }//单独托盘显示物料信息
    #endregion

    #region 生产部填写信息
    //包装长宽高
    private string? palletLength;
    public string? PalletLength
    {
        get => palletLength;
        set
        {
            palletLength = value;
            OnPropertyChanged();
        }
    }
    private string? palletWidth;
    public string? PalletWidth
    {
        get => palletWidth;
        set
        {
            palletWidth = value;
            OnPropertyChanged();
        }
    }
    private string? palletHeight;
    public string? PalletHeight
    {
        get => palletHeight;
        set
        {
            palletHeight = value;
            OnPropertyChanged();
        }
    }
    private string? grossWeight;
    public string? GrossWeight
    {
        get => grossWeight;
        set
        {
            grossWeight = value;
            OnPropertyChanged();
        }
    }
    private string? netWeight;
    public string? NetWeight
    {
        get => netWeight;
        set
        {
            netWeight = value;
            OnPropertyChanged();
        }
    }

    private string? remark;
    public string? Remark
    {
        get => remark;
        set { remark=value; OnPropertyChanged(); }
    }//备注
    #endregion
    
    #region 仓库填写信息
    //库位
    private WarehouseLocation_e location;
    public WarehouseLocation_e Location
    {
        get => location;
        set { location=value; OnPropertyChanged(); }
    }
    private DateTime? warehousingTime;
    public DateTime? WarehousingTime
    {
        get => warehousingTime;
        set
        {
            warehousingTime = value;
            OnPropertyChanged();
            OnPropertyChanged(nameof(IsWarehoused));//同时更新这个属性
        }
    }//第一台生产完工入库的时间->进入库存状态
    private DateTime? shippingTime;
    public DateTime? ShippingTime
    {
        get => shippingTime;
        set
        {
            shippingTime = value;
            OnPropertyChanged();
            OnPropertyChanged(nameof(IsShipped));//同时更新这个属性
        }
    }
    //项目第一台真实发货的时间->进入发货状态，用减去WarehousingTime，用户计算成品库存时间 
    #endregion
    
    #region 额外属性
    //是否被选中
    private bool isSelected;
    public bool IsSelected
    {
        get => isSelected;
        set
        {
            isSelected = value;
            OnPropertyChanged();
        }
    }
    #endregion

    #region 状态属性
    public bool IsWarehoused => WarehousingTime != null;
    public bool IsShipped => ShippingTime != null;
    #endregion
}